import {connect}from 'react-redux'
import Goods from '../ui/goods'
import {setcurrentshoplists} from '../actioncreater/goodsCreater'
const mapStateToProps=(state)=>{
    return {
        // restaurantId:'3307'
        shopinfo:state.cartReducer.currentshopinfo,
        currentshoplist:state.cartReducer.currentshoplist,
        currentshoptotal:state.cartReducer.currentshoplist.reduce((sum,val)=>{if(val.price==0){return sum}else{return sum+=val.num*val.price}},0)
    }
}
const mapDispatchToProps=(dispatch)=>{
    return {
        setcurrentshoplist(currentshoplist){
            // console.log(currentshoplist)
             dispatch(setcurrentshoplists(currentshoplist))
        }
    }
}
export default connect(mapStateToProps,mapDispatchToProps)(Goods)